# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
--- |

  define void @long_chain_ambiguous_i64_in_fpr(i1 %cnd0, i1 %cnd1, i1 %cnd2, i64* %a, i64* %b, i64* %c, i64* %result) {
  entry:
    br i1 %cnd0, label %pre.PHI.2, label %pre.PHI.1

  pre.PHI.1:                                        ; preds = %entry
    br i1 %cnd1, label %b.PHI.1.1, label %pre.PHI.1.0

  pre.PHI.1.0:                                      ; preds = %pre.PHI.1
    br i1 %cnd2, label %b.PHI.1.2, label %b.PHI.1.0

  b.PHI.1.0:                                        ; preds = %pre.PHI.1.0
    %phi1.0 = load i64, i64* %a
    br label %b.PHI.1

  b.PHI.1.1:                                        ; preds = %pre.PHI.1
    %phi1.1 = load i64, i64* %b
    br label %b.PHI.1

  b.PHI.1.2:                                        ; preds = %pre.PHI.1.0
    %phi1.2 = load i64, i64* %c
    br label %b.PHI.1

  b.PHI.1:                                          ; preds = %b.PHI.1.2, %b.PHI.1.1, %b.PHI.1.0
    %phi1 = phi i64 [ %phi1.0, %b.PHI.1.0 ], [ %phi1.1, %b.PHI.1.1 ], [ %phi1.2, %b.PHI.1.2 ]
    br i1 %cnd2, label %b.PHI.1.end, label %b.PHI.3

  b.PHI.1.end:                                      ; preds = %b.PHI.1
    store i64 %phi1, i64* %result
    ret void

  pre.PHI.2:                                        ; preds = %entry
    br i1 %cnd0, label %b.PHI.2.0, label %b.PHI.2.1

  b.PHI.2.0:                                        ; preds = %pre.PHI.2
    %phi2.0 = load i64, i64* %a
    br label %b.PHI.2

  b.PHI.2.1:                                        ; preds = %pre.PHI.2
    %phi2.1 = load i64, i64* %b
    br label %b.PHI.2

  b.PHI.2:                                          ; preds = %b.PHI.2.1, %b.PHI.2.0
    %phi2 = phi i64 [ %phi2.0, %b.PHI.2.0 ], [ %phi2.1, %b.PHI.2.1 ]
    br i1 %cnd1, label %b.PHI.3, label %b.PHI.2.end

  b.PHI.2.end:                                      ; preds = %b.PHI.2
    store i64 %phi2, i64* %result
    ret void

  b.PHI.3:                                          ; preds = %b.PHI.2, %b.PHI.1
    %phi3 = phi i64 [ %phi2, %b.PHI.2 ], [ %phi1, %b.PHI.1 ]
    %phi4 = phi i64 [ %phi2, %b.PHI.2 ], [ %phi1, %b.PHI.1 ]
    %sel_1.2 = select i1 %cnd2, i64 %phi3, i64 %phi4
    %sel_3_1.2 = select i1 %cnd1, i64 %sel_1.2, i64 %phi3
    store i64 %sel_3_1.2, i64* %result
    store i64 %phi3, i64* %result
    ret void
  }

  define void @long_chain_i64_in_gpr(i1 %cnd0, i1 %cnd1, i1 %cnd2, i64* %a, i64* %b, i64* %c, i64* %result) {
  entry:
    br i1 %cnd0, label %pre.PHI.2, label %pre.PHI.1

  pre.PHI.1:                                        ; preds = %entry
    br i1 %cnd1, label %b.PHI.1.1, label %pre.PHI.1.0

  pre.PHI.1.0:                                      ; preds = %pre.PHI.1
    br i1 %cnd2, label %b.PHI.1.2, label %b.PHI.1.0

  b.PHI.1.0:                                        ; preds = %pre.PHI.1.0
    %phi1.0 = load i64, i64* %a
    br label %b.PHI.1

  b.PHI.1.1:                                        ; preds = %pre.PHI.1
    %phi1.1 = load i64, i64* %b
    br label %b.PHI.1

  b.PHI.1.2:                                        ; preds = %pre.PHI.1.0
    %phi1.2 = load i64, i64* %c
    br label %b.PHI.1

  b.PHI.1:                                          ; preds = %b.PHI.1.2, %b.PHI.1.1, %b.PHI.1.0
    %phi1 = phi i64 [ %phi1.0, %b.PHI.1.0 ], [ %phi1.1, %b.PHI.1.1 ], [ %phi1.2, %b.PHI.1.2 ]
    br i1 %cnd2, label %b.PHI.1.end, label %b.PHI.3

  b.PHI.1.end:                                      ; preds = %b.PHI.1
    store i64 %phi1, i64* %result
    ret void

  pre.PHI.2:                                        ; preds = %entry
    br i1 %cnd0, label %b.PHI.2.0, label %b.PHI.2.1

  b.PHI.2.0:                                        ; preds = %pre.PHI.2
    %phi2.0 = load i64, i64* %a
    br label %b.PHI.2

  b.PHI.2.1:                                        ; preds = %pre.PHI.2
    %phi2.1 = load i64, i64* %b
    br label %b.PHI.2

  b.PHI.2:                                          ; preds = %b.PHI.2.1, %b.PHI.2.0
    %phi2 = phi i64 [ %phi2.0, %b.PHI.2.0 ], [ %phi2.1, %b.PHI.2.1 ]
    br i1 %cnd1, label %b.PHI.3, label %b.PHI.2.end

  b.PHI.2.end:                                      ; preds = %b.PHI.2
    store i64 %phi2, i64* %result
    ret void

  b.PHI.3:                                          ; preds = %b.PHI.2, %b.PHI.1
    %phi3 = phi i64 [ %phi2, %b.PHI.2 ], [ %phi1, %b.PHI.1 ]
    %phi4 = phi i64 [ %phi2, %b.PHI.2 ], [ 0, %b.PHI.1 ]
    %sel_1.2 = select i1 %cnd2, i64 %phi3, i64 %phi4
    %sel_3_1.2 = select i1 %cnd1, i64 %sel_1.2, i64 %phi3
    store i64 %sel_3_1.2, i64* %result
    store i64 %phi3, i64* %result
    ret void
  }

  define void @long_chain_ambiguous_double_in_fpr(i1 %cnd0, i1 %cnd1, i1 %cnd2, double* %a, double* %b, double* %c, double* %result) {
  entry:
    br i1 %cnd0, label %pre.PHI.2, label %pre.PHI.1

  pre.PHI.1:                                        ; preds = %entry
    br i1 %cnd1, label %b.PHI.1.1, label %pre.PHI.1.0

  pre.PHI.1.0:                                      ; preds = %pre.PHI.1
    br i1 %cnd2, label %b.PHI.1.2, label %b.PHI.1.0

  b.PHI.1.0:                                        ; preds = %pre.PHI.1.0
    %phi1.0 = load double, double* %a
    br label %b.PHI.1

  b.PHI.1.1:                                        ; preds = %pre.PHI.1
    %phi1.1 = load double, double* %b
    br label %b.PHI.1

  b.PHI.1.2:                                        ; preds = %pre.PHI.1.0
    %phi1.2 = load double, double* %c
    br label %b.PHI.1

  b.PHI.1:                                          ; preds = %b.PHI.1.2, %b.PHI.1.1, %b.PHI.1.0
    %phi1 = phi double [ %phi1.0, %b.PHI.1.0 ], [ %phi1.1, %b.PHI.1.1 ], [ %phi1.2, %b.PHI.1.2 ]
    br i1 %cnd2, label %b.PHI.1.end, label %b.PHI.3

  b.PHI.1.end:                                      ; preds = %b.PHI.1
    store double %phi1, double* %result
    ret void

  pre.PHI.2:                                        ; preds = %entry
    br i1 %cnd0, label %b.PHI.2.0, label %b.PHI.2.1

  b.PHI.2.0:                                        ; preds = %pre.PHI.2
    %phi2.0 = load double, double* %a
    br label %b.PHI.2

  b.PHI.2.1:                                        ; preds = %pre.PHI.2
    %phi2.1 = load double, double* %b
    br label %b.PHI.2

  b.PHI.2:                                          ; preds = %b.PHI.2.1, %b.PHI.2.0
    %phi2 = phi double [ %phi2.0, %b.PHI.2.0 ], [ %phi2.1, %b.PHI.2.1 ]
    br i1 %cnd1, label %b.PHI.3, label %b.PHI.2.end

  b.PHI.2.end:                                      ; preds = %b.PHI.2
    store double %phi2, double* %result
    ret void

  b.PHI.3:                                          ; preds = %b.PHI.2, %b.PHI.1
    %phi3 = phi double [ %phi2, %b.PHI.2 ], [ %phi1, %b.PHI.1 ]
    %phi4 = phi double [ %phi2, %b.PHI.2 ], [ %phi1, %b.PHI.1 ]
    %sel_1.2 = select i1 %cnd2, double %phi3, double %phi4
    %sel_3_1.2 = select i1 %cnd1, double %sel_1.2, double %phi3
    store double %sel_3_1.2, double* %result
    store double %phi3, double* %result
    ret void
  }

  define void @long_chain_double_in_fpr(i1 %cnd0, i1 %cnd1, i1 %cnd2, double* %a, double* %b, double* %c, double* %result) {
  entry:
    br i1 %cnd0, label %pre.PHI.2, label %pre.PHI.1

  pre.PHI.1:                                        ; preds = %entry
    br i1 %cnd1, label %b.PHI.1.1, label %pre.PHI.1.0

  pre.PHI.1.0:                                      ; preds = %pre.PHI.1
    br i1 %cnd2, label %b.PHI.1.2, label %b.PHI.1.0

  b.PHI.1.0:                                        ; preds = %pre.PHI.1.0
    %phi1.0 = load double, double* %a
    br label %b.PHI.1

  b.PHI.1.1:                                        ; preds = %pre.PHI.1
    %phi1.1 = load double, double* %b
    br label %b.PHI.1

  b.PHI.1.2:                                        ; preds = %pre.PHI.1.0
    %phi1.2 = load double, double* %c
    br label %b.PHI.1

  b.PHI.1:                                          ; preds = %b.PHI.1.2, %b.PHI.1.1, %b.PHI.1.0
    %phi1 = phi double [ %phi1.0, %b.PHI.1.0 ], [ %phi1.1, %b.PHI.1.1 ], [ %phi1.2, %b.PHI.1.2 ]
    br i1 %cnd2, label %b.PHI.1.end, label %b.PHI.3

  b.PHI.1.end:                                      ; preds = %b.PHI.1
    store double %phi1, double* %result
    ret void

  pre.PHI.2:                                        ; preds = %entry
    br i1 %cnd0, label %b.PHI.2.0, label %b.PHI.2.1

  b.PHI.2.0:                                        ; preds = %pre.PHI.2
    %phi2.0 = load double, double* %a
    br label %b.PHI.2

  b.PHI.2.1:                                        ; preds = %pre.PHI.2
    %phi2.1 = load double, double* %b
    br label %b.PHI.2

  b.PHI.2:                                          ; preds = %b.PHI.2.1, %b.PHI.2.0
    %phi2 = phi double [ %phi2.0, %b.PHI.2.0 ], [ %phi2.1, %b.PHI.2.1 ]
    br i1 %cnd1, label %b.PHI.3, label %b.PHI.2.end

  b.PHI.2.end:                                      ; preds = %b.PHI.2
    store double %phi2, double* %result
    ret void

  b.PHI.3:                                          ; preds = %b.PHI.2, %b.PHI.1
    %phi3 = phi double [ %phi2, %b.PHI.2 ], [ %phi1, %b.PHI.1 ]
    %phi4 = phi double [ %phi2, %b.PHI.2 ], [ 0.000000e+00, %b.PHI.1 ]
    %sel_1.2 = select i1 %cnd2, double %phi3, double %phi4
    %sel_3_1.2 = select i1 %cnd1, double %sel_1.2, double %phi3
    store double %sel_3_1.2, double* %result
    store double %phi3, double* %result
    ret void
  }

...
---
name:            long_chain_ambiguous_i64_in_fpr
alignment:       4
legalized:       true
tracksRegLiveness: true
fixedStack:
  - { id: 0, offset: 24, size: 4, alignment: 8, isImmutable: true }
  - { id: 1, offset: 20, size: 4, alignment: 4, isImmutable: true }
  - { id: 2, offset: 16, size: 4, alignment: 8, isImmutable: true }
body:             |
  ; MIPS32-LABEL: name: long_chain_ambiguous_i64_in_fpr
  ; MIPS32: bb.0.entry:
  ; MIPS32:   successors: %bb.8(0x40000000), %bb.1(0x40000000)
  ; MIPS32:   liveins: $a0, $a1, $a2, $a3
  ; MIPS32:   [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
  ; MIPS32:   [[COPY1:%[0-9]+]]:gprb(s32) = COPY $a1
  ; MIPS32:   [[COPY2:%[0-9]+]]:gprb(s32) = COPY $a2
  ; MIPS32:   [[COPY3:%[0-9]+]]:gprb(p0) = COPY $a3
  ; MIPS32:   [[FRAME_INDEX:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
  ; MIPS32:   [[LOAD:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (load (p0) from %fixed-stack.0, align 8)
  ; MIPS32:   [[FRAME_INDEX1:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.1
  ; MIPS32:   [[LOAD1:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX1]](p0) :: (load (p0) from %fixed-stack.1)
  ; MIPS32:   [[FRAME_INDEX2:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.2
  ; MIPS32:   [[LOAD2:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX2]](p0) :: (load (p0) from %fixed-stack.2, align 8)
  ; MIPS32:   [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY4:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
  ; MIPS32:   [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY4]], [[C]]
  ; MIPS32:   G_BRCOND [[AND]](s32), %bb.8
  ; MIPS32: bb.1.pre.PHI.1:
  ; MIPS32:   successors: %bb.4(0x40000000), %bb.2(0x40000000)
  ; MIPS32:   [[C1:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY5:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND1:%[0-9]+]]:gprb(s32) = G_AND [[COPY5]], [[C1]]
  ; MIPS32:   G_BRCOND [[AND1]](s32), %bb.4
  ; MIPS32: bb.2.pre.PHI.1.0:
  ; MIPS32:   successors: %bb.5(0x40000000), %bb.3(0x40000000)
  ; MIPS32:   [[C2:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY6:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND2:%[0-9]+]]:gprb(s32) = G_AND [[COPY6]], [[C2]]
  ; MIPS32:   G_BRCOND [[AND2]](s32), %bb.5
  ; MIPS32: bb.3.b.PHI.1.0:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD3:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY3]](p0) :: (load (s64) from %ir.a)
  ; MIPS32:   G_BR %bb.6
  ; MIPS32: bb.4.b.PHI.1.1:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD4:%[0-9]+]]:fprb(s64) = G_LOAD [[LOAD]](p0) :: (load (s64) from %ir.b)
  ; MIPS32:   G_BR %bb.6
  ; MIPS32: bb.5.b.PHI.1.2:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD5:%[0-9]+]]:fprb(s64) = G_LOAD [[LOAD1]](p0) :: (load (s64) from %ir.c)
  ; MIPS32: bb.6.b.PHI.1:
  ; MIPS32:   successors: %bb.7(0x40000000), %bb.13(0x40000000)
  ; MIPS32:   [[PHI:%[0-9]+]]:fprb(s64) = G_PHI [[LOAD3]](s64), %bb.3, [[LOAD4]](s64), %bb.4, [[LOAD5]](s64), %bb.5
  ; MIPS32:   [[C3:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY7:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND3:%[0-9]+]]:gprb(s32) = G_AND [[COPY7]], [[C3]]
  ; MIPS32:   G_BRCOND [[AND3]](s32), %bb.7
  ; MIPS32:   G_BR %bb.13
  ; MIPS32: bb.7.b.PHI.1.end:
  ; MIPS32:   G_STORE [[PHI]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   RetRA
  ; MIPS32: bb.8.pre.PHI.2:
  ; MIPS32:   successors: %bb.9(0x40000000), %bb.10(0x40000000)
  ; MIPS32:   [[C4:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY8:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
  ; MIPS32:   [[AND4:%[0-9]+]]:gprb(s32) = G_AND [[COPY8]], [[C4]]
  ; MIPS32:   G_BRCOND [[AND4]](s32), %bb.9
  ; MIPS32:   G_BR %bb.10
  ; MIPS32: bb.9.b.PHI.2.0:
  ; MIPS32:   successors: %bb.11(0x80000000)
  ; MIPS32:   [[LOAD6:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY3]](p0) :: (load (s64) from %ir.a)
  ; MIPS32:   G_BR %bb.11
  ; MIPS32: bb.10.b.PHI.2.1:
  ; MIPS32:   successors: %bb.11(0x80000000)
  ; MIPS32:   [[LOAD7:%[0-9]+]]:fprb(s64) = G_LOAD [[LOAD]](p0) :: (load (s64) from %ir.b)
  ; MIPS32: bb.11.b.PHI.2:
  ; MIPS32:   successors: %bb.13(0x40000000), %bb.12(0x40000000)
  ; MIPS32:   [[PHI1:%[0-9]+]]:fprb(s64) = G_PHI [[LOAD6]](s64), %bb.9, [[LOAD7]](s64), %bb.10
  ; MIPS32:   [[C5:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY9:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND5:%[0-9]+]]:gprb(s32) = G_AND [[COPY9]], [[C5]]
  ; MIPS32:   G_BRCOND [[AND5]](s32), %bb.13
  ; MIPS32: bb.12.b.PHI.2.end:
  ; MIPS32:   G_STORE [[PHI1]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   RetRA
  ; MIPS32: bb.13.b.PHI.3:
  ; MIPS32:   [[PHI2:%[0-9]+]]:fprb(s64) = G_PHI [[PHI1]](s64), %bb.11, [[PHI]](s64), %bb.6
  ; MIPS32:   [[PHI3:%[0-9]+]]:fprb(s64) = G_PHI [[PHI1]](s64), %bb.11, [[PHI]](s64), %bb.6
  ; MIPS32:   [[C6:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY10:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND6:%[0-9]+]]:gprb(s32) = G_AND [[COPY10]], [[C6]]
  ; MIPS32:   [[SELECT:%[0-9]+]]:fprb(s64) = G_SELECT [[AND6]](s32), [[PHI2]], [[PHI3]]
  ; MIPS32:   [[COPY11:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND7:%[0-9]+]]:gprb(s32) = G_AND [[COPY11]], [[C6]]
  ; MIPS32:   [[SELECT1:%[0-9]+]]:fprb(s64) = G_SELECT [[AND7]](s32), [[SELECT]], [[PHI2]]
  ; MIPS32:   G_STORE [[SELECT1]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   G_STORE [[PHI2]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   RetRA
  bb.1.entry:
    liveins: $a0, $a1, $a2, $a3

    %7:_(s32) = COPY $a0
    %8:_(s32) = COPY $a1
    %9:_(s32) = COPY $a2
    %3:_(p0) = COPY $a3
    %10:_(p0) = G_FRAME_INDEX %fixed-stack.2
    %4:_(p0) = G_LOAD %10(p0) :: (load (p0) from %fixed-stack.2, align 8)
    %11:_(p0) = G_FRAME_INDEX %fixed-stack.1
    %5:_(p0) = G_LOAD %11(p0) :: (load (p0) from %fixed-stack.1)
    %12:_(p0) = G_FRAME_INDEX %fixed-stack.0
    %6:_(p0) = G_LOAD %12(p0) :: (load (p0) from %fixed-stack.0, align 8)
    %32:_(s32) = G_CONSTANT i32 1
    %33:_(s32) = COPY %7(s32)
    %31:_(s32) = G_AND %33, %32
    G_BRCOND %31(s32), %bb.9

  bb.2.pre.PHI.1:
    %34:_(s32) = G_CONSTANT i32 1
    %35:_(s32) = COPY %8(s32)
    %30:_(s32) = G_AND %35, %34
    G_BRCOND %30(s32), %bb.5

  bb.3.pre.PHI.1.0:
    %36:_(s32) = G_CONSTANT i32 1
    %37:_(s32) = COPY %9(s32)
    %29:_(s32) = G_AND %37, %36
    G_BRCOND %29(s32), %bb.6

  bb.4.b.PHI.1.0:
    %13:_(s64) = G_LOAD %3(p0) :: (load (s64) from %ir.a)
    G_BR %bb.7

  bb.5.b.PHI.1.1:
    %15:_(s64) = G_LOAD %4(p0) :: (load (s64) from %ir.b)
    G_BR %bb.7

  bb.6.b.PHI.1.2:
    %14:_(s64) = G_LOAD %5(p0) :: (load (s64) from %ir.c)

  bb.7.b.PHI.1:
    %16:_(s64) = G_PHI %13(s64), %bb.4, %15(s64), %bb.5, %14(s64), %bb.6
    %38:_(s32) = G_CONSTANT i32 1
    %39:_(s32) = COPY %9(s32)
    %28:_(s32) = G_AND %39, %38
    G_BRCOND %28(s32), %bb.8
    G_BR %bb.14

  bb.8.b.PHI.1.end:
    G_STORE %16(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

  bb.9.pre.PHI.2:
    %40:_(s32) = G_CONSTANT i32 1
    %41:_(s32) = COPY %7(s32)
    %27:_(s32) = G_AND %41, %40
    G_BRCOND %27(s32), %bb.10
    G_BR %bb.11

  bb.10.b.PHI.2.0:
    %18:_(s64) = G_LOAD %3(p0) :: (load (s64) from %ir.a)
    G_BR %bb.12

  bb.11.b.PHI.2.1:
    %17:_(s64) = G_LOAD %4(p0) :: (load (s64) from %ir.b)

  bb.12.b.PHI.2:
    %19:_(s64) = G_PHI %18(s64), %bb.10, %17(s64), %bb.11
    %42:_(s32) = G_CONSTANT i32 1
    %43:_(s32) = COPY %8(s32)
    %26:_(s32) = G_AND %43, %42
    G_BRCOND %26(s32), %bb.14

  bb.13.b.PHI.2.end:
    G_STORE %19(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

  bb.14.b.PHI.3:
    %20:_(s64) = G_PHI %19(s64), %bb.12, %16(s64), %bb.7
    %21:_(s64) = G_PHI %19(s64), %bb.12, %16(s64), %bb.7
    %44:_(s32) = G_CONSTANT i32 1
    %45:_(s32) = COPY %9(s32)
    %25:_(s32) = G_AND %45, %44
    %22:_(s64) = G_SELECT %25(s32), %20, %21
    %46:_(s32) = COPY %8(s32)
    %24:_(s32) = G_AND %46, %44
    %23:_(s64) = G_SELECT %24(s32), %22, %20
    G_STORE %23(s64), %6(p0) :: (store (s64) into %ir.result)
    G_STORE %20(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

...
---
name:            long_chain_i64_in_gpr
alignment:       4
legalized:       true
tracksRegLiveness: true
fixedStack:
  - { id: 0, offset: 24, size: 4, alignment: 8, isImmutable: true }
  - { id: 1, offset: 20, size: 4, alignment: 4, isImmutable: true }
  - { id: 2, offset: 16, size: 4, alignment: 8, isImmutable: true }
body:             |
  ; MIPS32-LABEL: name: long_chain_i64_in_gpr
  ; MIPS32: bb.0.entry:
  ; MIPS32:   successors: %bb.8(0x40000000), %bb.1(0x40000000)
  ; MIPS32:   liveins: $a0, $a1, $a2, $a3
  ; MIPS32:   [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
  ; MIPS32:   [[COPY1:%[0-9]+]]:gprb(s32) = COPY $a1
  ; MIPS32:   [[COPY2:%[0-9]+]]:gprb(s32) = COPY $a2
  ; MIPS32:   [[COPY3:%[0-9]+]]:gprb(p0) = COPY $a3
  ; MIPS32:   [[FRAME_INDEX:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
  ; MIPS32:   [[LOAD:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (load (p0) from %fixed-stack.0, align 8)
  ; MIPS32:   [[FRAME_INDEX1:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.1
  ; MIPS32:   [[LOAD1:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX1]](p0) :: (load (p0) from %fixed-stack.1)
  ; MIPS32:   [[FRAME_INDEX2:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.2
  ; MIPS32:   [[LOAD2:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX2]](p0) :: (load (p0) from %fixed-stack.2, align 8)
  ; MIPS32:   [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 0
  ; MIPS32:   [[C1:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY4:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
  ; MIPS32:   [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY4]], [[C1]]
  ; MIPS32:   G_BRCOND [[AND]](s32), %bb.8
  ; MIPS32: bb.1.pre.PHI.1:
  ; MIPS32:   successors: %bb.4(0x40000000), %bb.2(0x40000000)
  ; MIPS32:   [[C2:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY5:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND1:%[0-9]+]]:gprb(s32) = G_AND [[COPY5]], [[C2]]
  ; MIPS32:   G_BRCOND [[AND1]](s32), %bb.4
  ; MIPS32: bb.2.pre.PHI.1.0:
  ; MIPS32:   successors: %bb.5(0x40000000), %bb.3(0x40000000)
  ; MIPS32:   [[C3:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY6:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND2:%[0-9]+]]:gprb(s32) = G_AND [[COPY6]], [[C3]]
  ; MIPS32:   G_BRCOND [[AND2]](s32), %bb.5
  ; MIPS32: bb.3.b.PHI.1.0:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD3:%[0-9]+]]:gprb(s32) = G_LOAD [[COPY3]](p0) :: (load (s32) from %ir.a, align 8)
  ; MIPS32:   [[C4:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
  ; MIPS32:   [[PTR_ADD:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[COPY3]], [[C4]](s32)
  ; MIPS32:   [[LOAD4:%[0-9]+]]:gprb(s32) = G_LOAD [[PTR_ADD]](p0) :: (load (s32) from %ir.a + 4, basealign 8)
  ; MIPS32:   G_BR %bb.6
  ; MIPS32: bb.4.b.PHI.1.1:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD5:%[0-9]+]]:gprb(s32) = G_LOAD [[LOAD]](p0) :: (load (s32) from %ir.b, align 8)
  ; MIPS32:   [[C5:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
  ; MIPS32:   [[PTR_ADD1:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[LOAD]], [[C5]](s32)
  ; MIPS32:   [[LOAD6:%[0-9]+]]:gprb(s32) = G_LOAD [[PTR_ADD1]](p0) :: (load (s32) from %ir.b + 4, basealign 8)
  ; MIPS32:   G_BR %bb.6
  ; MIPS32: bb.5.b.PHI.1.2:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD7:%[0-9]+]]:gprb(s32) = G_LOAD [[LOAD1]](p0) :: (load (s32) from %ir.c, align 8)
  ; MIPS32:   [[C6:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
  ; MIPS32:   [[PTR_ADD2:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[LOAD1]], [[C6]](s32)
  ; MIPS32:   [[LOAD8:%[0-9]+]]:gprb(s32) = G_LOAD [[PTR_ADD2]](p0) :: (load (s32) from %ir.c + 4, basealign 8)
  ; MIPS32: bb.6.b.PHI.1:
  ; MIPS32:   successors: %bb.7(0x40000000), %bb.13(0x40000000)
  ; MIPS32:   [[PHI:%[0-9]+]]:gprb(s32) = G_PHI [[LOAD3]](s32), %bb.3, [[LOAD5]](s32), %bb.4, [[LOAD7]](s32), %bb.5
  ; MIPS32:   [[PHI1:%[0-9]+]]:gprb(s32) = G_PHI [[LOAD4]](s32), %bb.3, [[LOAD6]](s32), %bb.4, [[LOAD8]](s32), %bb.5
  ; MIPS32:   [[C7:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY7:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND3:%[0-9]+]]:gprb(s32) = G_AND [[COPY7]], [[C7]]
  ; MIPS32:   G_BRCOND [[AND3]](s32), %bb.7
  ; MIPS32:   G_BR %bb.13
  ; MIPS32: bb.7.b.PHI.1.end:
  ; MIPS32:   G_STORE [[PHI]](s32), [[LOAD2]](p0) :: (store (s32) into %ir.result, align 8)
  ; MIPS32:   [[C8:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
  ; MIPS32:   [[PTR_ADD3:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[LOAD2]], [[C8]](s32)
  ; MIPS32:   G_STORE [[PHI1]](s32), [[PTR_ADD3]](p0) :: (store (s32) into %ir.result + 4, basealign 8)
  ; MIPS32:   RetRA
  ; MIPS32: bb.8.pre.PHI.2:
  ; MIPS32:   successors: %bb.9(0x40000000), %bb.10(0x40000000)
  ; MIPS32:   [[C9:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY8:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
  ; MIPS32:   [[AND4:%[0-9]+]]:gprb(s32) = G_AND [[COPY8]], [[C9]]
  ; MIPS32:   G_BRCOND [[AND4]](s32), %bb.9
  ; MIPS32:   G_BR %bb.10
  ; MIPS32: bb.9.b.PHI.2.0:
  ; MIPS32:   successors: %bb.11(0x80000000)
  ; MIPS32:   [[LOAD9:%[0-9]+]]:gprb(s32) = G_LOAD [[COPY3]](p0) :: (load (s32) from %ir.a, align 8)
  ; MIPS32:   [[C10:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
  ; MIPS32:   [[PTR_ADD4:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[COPY3]], [[C10]](s32)
  ; MIPS32:   [[LOAD10:%[0-9]+]]:gprb(s32) = G_LOAD [[PTR_ADD4]](p0) :: (load (s32) from %ir.a + 4, basealign 8)
  ; MIPS32:   G_BR %bb.11
  ; MIPS32: bb.10.b.PHI.2.1:
  ; MIPS32:   successors: %bb.11(0x80000000)
  ; MIPS32:   [[LOAD11:%[0-9]+]]:gprb(s32) = G_LOAD [[LOAD]](p0) :: (load (s32) from %ir.b, align 8)
  ; MIPS32:   [[C11:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
  ; MIPS32:   [[PTR_ADD5:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[LOAD]], [[C11]](s32)
  ; MIPS32:   [[LOAD12:%[0-9]+]]:gprb(s32) = G_LOAD [[PTR_ADD5]](p0) :: (load (s32) from %ir.b + 4, basealign 8)
  ; MIPS32: bb.11.b.PHI.2:
  ; MIPS32:   successors: %bb.13(0x40000000), %bb.12(0x40000000)
  ; MIPS32:   [[PHI2:%[0-9]+]]:gprb(s32) = G_PHI [[LOAD9]](s32), %bb.9, [[LOAD11]](s32), %bb.10
  ; MIPS32:   [[PHI3:%[0-9]+]]:gprb(s32) = G_PHI [[LOAD10]](s32), %bb.9, [[LOAD12]](s32), %bb.10
  ; MIPS32:   [[C12:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY9:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND5:%[0-9]+]]:gprb(s32) = G_AND [[COPY9]], [[C12]]
  ; MIPS32:   G_BRCOND [[AND5]](s32), %bb.13
  ; MIPS32: bb.12.b.PHI.2.end:
  ; MIPS32:   G_STORE [[PHI2]](s32), [[LOAD2]](p0) :: (store (s32) into %ir.result, align 8)
  ; MIPS32:   [[C13:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
  ; MIPS32:   [[PTR_ADD6:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[LOAD2]], [[C13]](s32)
  ; MIPS32:   G_STORE [[PHI3]](s32), [[PTR_ADD6]](p0) :: (store (s32) into %ir.result + 4, basealign 8)
  ; MIPS32:   RetRA
  ; MIPS32: bb.13.b.PHI.3:
  ; MIPS32:   [[PHI4:%[0-9]+]]:gprb(s32) = G_PHI [[PHI2]](s32), %bb.11, [[PHI]](s32), %bb.6
  ; MIPS32:   [[PHI5:%[0-9]+]]:gprb(s32) = G_PHI [[PHI3]](s32), %bb.11, [[PHI1]](s32), %bb.6
  ; MIPS32:   [[PHI6:%[0-9]+]]:gprb(s32) = G_PHI [[PHI2]](s32), %bb.11, [[C]](s32), %bb.6
  ; MIPS32:   [[PHI7:%[0-9]+]]:gprb(s32) = G_PHI [[PHI3]](s32), %bb.11, [[C]](s32), %bb.6
  ; MIPS32:   [[C14:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY10:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND6:%[0-9]+]]:gprb(s32) = G_AND [[COPY10]], [[C14]]
  ; MIPS32:   [[SELECT:%[0-9]+]]:gprb(s32) = G_SELECT [[AND6]](s32), [[PHI4]], [[PHI6]]
  ; MIPS32:   [[SELECT1:%[0-9]+]]:gprb(s32) = G_SELECT [[AND6]](s32), [[PHI5]], [[PHI7]]
  ; MIPS32:   [[COPY11:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND7:%[0-9]+]]:gprb(s32) = G_AND [[COPY11]], [[C14]]
  ; MIPS32:   [[SELECT2:%[0-9]+]]:gprb(s32) = G_SELECT [[AND7]](s32), [[SELECT]], [[PHI4]]
  ; MIPS32:   [[SELECT3:%[0-9]+]]:gprb(s32) = G_SELECT [[AND7]](s32), [[SELECT1]], [[PHI5]]
  ; MIPS32:   G_STORE [[SELECT2]](s32), [[LOAD2]](p0) :: (store (s32) into %ir.result, align 8)
  ; MIPS32:   [[C15:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
  ; MIPS32:   [[PTR_ADD7:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[LOAD2]], [[C15]](s32)
  ; MIPS32:   G_STORE [[SELECT3]](s32), [[PTR_ADD7]](p0) :: (store (s32) into %ir.result + 4, basealign 8)
  ; MIPS32:   G_STORE [[PHI4]](s32), [[LOAD2]](p0) :: (store (s32) into %ir.result, align 8)
  ; MIPS32:   [[C16:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
  ; MIPS32:   [[PTR_ADD8:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[LOAD2]], [[C16]](s32)
  ; MIPS32:   G_STORE [[PHI5]](s32), [[PTR_ADD8]](p0) :: (store (s32) into %ir.result + 4, basealign 8)
  ; MIPS32:   RetRA
  bb.1.entry:
    liveins: $a0, $a1, $a2, $a3

    %7:_(s32) = COPY $a0
    %8:_(s32) = COPY $a1
    %9:_(s32) = COPY $a2
    %3:_(p0) = COPY $a3
    %10:_(p0) = G_FRAME_INDEX %fixed-stack.2
    %4:_(p0) = G_LOAD %10(p0) :: (load (p0) from %fixed-stack.2, align 8)
    %11:_(p0) = G_FRAME_INDEX %fixed-stack.1
    %5:_(p0) = G_LOAD %11(p0) :: (load (p0) from %fixed-stack.1)
    %12:_(p0) = G_FRAME_INDEX %fixed-stack.0
    %6:_(p0) = G_LOAD %12(p0) :: (load (p0) from %fixed-stack.0, align 8)
    %33:_(s32) = G_CONSTANT i32 0
    %24:_(s64) = G_MERGE_VALUES %33(s32), %33(s32)
    %34:_(s32) = G_CONSTANT i32 1
    %35:_(s32) = COPY %7(s32)
    %32:_(s32) = G_AND %35, %34
    G_BRCOND %32(s32), %bb.9

  bb.2.pre.PHI.1:
    %36:_(s32) = G_CONSTANT i32 1
    %37:_(s32) = COPY %8(s32)
    %31:_(s32) = G_AND %37, %36
    G_BRCOND %31(s32), %bb.5

  bb.3.pre.PHI.1.0:
    %38:_(s32) = G_CONSTANT i32 1
    %39:_(s32) = COPY %9(s32)
    %30:_(s32) = G_AND %39, %38
    G_BRCOND %30(s32), %bb.6

  bb.4.b.PHI.1.0:
    %13:_(s64) = G_LOAD %3(p0) :: (load (s64) from %ir.a)
    G_BR %bb.7

  bb.5.b.PHI.1.1:
    %15:_(s64) = G_LOAD %4(p0) :: (load (s64) from %ir.b)
    G_BR %bb.7

  bb.6.b.PHI.1.2:
    %14:_(s64) = G_LOAD %5(p0) :: (load (s64) from %ir.c)

  bb.7.b.PHI.1:
    %16:_(s64) = G_PHI %13(s64), %bb.4, %15(s64), %bb.5, %14(s64), %bb.6
    %40:_(s32) = G_CONSTANT i32 1
    %41:_(s32) = COPY %9(s32)
    %29:_(s32) = G_AND %41, %40
    G_BRCOND %29(s32), %bb.8
    G_BR %bb.14

  bb.8.b.PHI.1.end:
    G_STORE %16(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

  bb.9.pre.PHI.2:
    %42:_(s32) = G_CONSTANT i32 1
    %43:_(s32) = COPY %7(s32)
    %28:_(s32) = G_AND %43, %42
    G_BRCOND %28(s32), %bb.10
    G_BR %bb.11

  bb.10.b.PHI.2.0:
    %18:_(s64) = G_LOAD %3(p0) :: (load (s64) from %ir.a)
    G_BR %bb.12

  bb.11.b.PHI.2.1:
    %17:_(s64) = G_LOAD %4(p0) :: (load (s64) from %ir.b)

  bb.12.b.PHI.2:
    %19:_(s64) = G_PHI %18(s64), %bb.10, %17(s64), %bb.11
    %44:_(s32) = G_CONSTANT i32 1
    %45:_(s32) = COPY %8(s32)
    %27:_(s32) = G_AND %45, %44
    G_BRCOND %27(s32), %bb.14

  bb.13.b.PHI.2.end:
    G_STORE %19(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

  bb.14.b.PHI.3:
    %20:_(s64) = G_PHI %19(s64), %bb.12, %16(s64), %bb.7
    %21:_(s64) = G_PHI %19(s64), %bb.12, %24(s64), %bb.7
    %46:_(s32) = G_CONSTANT i32 1
    %47:_(s32) = COPY %9(s32)
    %26:_(s32) = G_AND %47, %46
    %22:_(s64) = G_SELECT %26(s32), %20, %21
    %48:_(s32) = COPY %8(s32)
    %25:_(s32) = G_AND %48, %46
    %23:_(s64) = G_SELECT %25(s32), %22, %20
    G_STORE %23(s64), %6(p0) :: (store (s64) into %ir.result)
    G_STORE %20(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

...
---
name:            long_chain_ambiguous_double_in_fpr
alignment:       4
legalized:       true
tracksRegLiveness: true
fixedStack:
  - { id: 0, offset: 24, size: 4, alignment: 8, isImmutable: true }
  - { id: 1, offset: 20, size: 4, alignment: 4, isImmutable: true }
  - { id: 2, offset: 16, size: 4, alignment: 8, isImmutable: true }
body:             |
  ; MIPS32-LABEL: name: long_chain_ambiguous_double_in_fpr
  ; MIPS32: bb.0.entry:
  ; MIPS32:   successors: %bb.8(0x40000000), %bb.1(0x40000000)
  ; MIPS32:   liveins: $a0, $a1, $a2, $a3
  ; MIPS32:   [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
  ; MIPS32:   [[COPY1:%[0-9]+]]:gprb(s32) = COPY $a1
  ; MIPS32:   [[COPY2:%[0-9]+]]:gprb(s32) = COPY $a2
  ; MIPS32:   [[COPY3:%[0-9]+]]:gprb(p0) = COPY $a3
  ; MIPS32:   [[FRAME_INDEX:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
  ; MIPS32:   [[LOAD:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (load (p0) from %fixed-stack.0, align 8)
  ; MIPS32:   [[FRAME_INDEX1:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.1
  ; MIPS32:   [[LOAD1:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX1]](p0) :: (load (p0) from %fixed-stack.1)
  ; MIPS32:   [[FRAME_INDEX2:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.2
  ; MIPS32:   [[LOAD2:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX2]](p0) :: (load (p0) from %fixed-stack.2, align 8)
  ; MIPS32:   [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY4:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
  ; MIPS32:   [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY4]], [[C]]
  ; MIPS32:   G_BRCOND [[AND]](s32), %bb.8
  ; MIPS32: bb.1.pre.PHI.1:
  ; MIPS32:   successors: %bb.4(0x40000000), %bb.2(0x40000000)
  ; MIPS32:   [[C1:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY5:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND1:%[0-9]+]]:gprb(s32) = G_AND [[COPY5]], [[C1]]
  ; MIPS32:   G_BRCOND [[AND1]](s32), %bb.4
  ; MIPS32: bb.2.pre.PHI.1.0:
  ; MIPS32:   successors: %bb.5(0x40000000), %bb.3(0x40000000)
  ; MIPS32:   [[C2:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY6:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND2:%[0-9]+]]:gprb(s32) = G_AND [[COPY6]], [[C2]]
  ; MIPS32:   G_BRCOND [[AND2]](s32), %bb.5
  ; MIPS32: bb.3.b.PHI.1.0:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD3:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY3]](p0) :: (load (s64) from %ir.a)
  ; MIPS32:   G_BR %bb.6
  ; MIPS32: bb.4.b.PHI.1.1:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD4:%[0-9]+]]:fprb(s64) = G_LOAD [[LOAD]](p0) :: (load (s64) from %ir.b)
  ; MIPS32:   G_BR %bb.6
  ; MIPS32: bb.5.b.PHI.1.2:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD5:%[0-9]+]]:fprb(s64) = G_LOAD [[LOAD1]](p0) :: (load (s64) from %ir.c)
  ; MIPS32: bb.6.b.PHI.1:
  ; MIPS32:   successors: %bb.7(0x40000000), %bb.13(0x40000000)
  ; MIPS32:   [[PHI:%[0-9]+]]:fprb(s64) = G_PHI [[LOAD3]](s64), %bb.3, [[LOAD4]](s64), %bb.4, [[LOAD5]](s64), %bb.5
  ; MIPS32:   [[C3:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY7:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND3:%[0-9]+]]:gprb(s32) = G_AND [[COPY7]], [[C3]]
  ; MIPS32:   G_BRCOND [[AND3]](s32), %bb.7
  ; MIPS32:   G_BR %bb.13
  ; MIPS32: bb.7.b.PHI.1.end:
  ; MIPS32:   G_STORE [[PHI]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   RetRA
  ; MIPS32: bb.8.pre.PHI.2:
  ; MIPS32:   successors: %bb.9(0x40000000), %bb.10(0x40000000)
  ; MIPS32:   [[C4:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY8:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
  ; MIPS32:   [[AND4:%[0-9]+]]:gprb(s32) = G_AND [[COPY8]], [[C4]]
  ; MIPS32:   G_BRCOND [[AND4]](s32), %bb.9
  ; MIPS32:   G_BR %bb.10
  ; MIPS32: bb.9.b.PHI.2.0:
  ; MIPS32:   successors: %bb.11(0x80000000)
  ; MIPS32:   [[LOAD6:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY3]](p0) :: (load (s64) from %ir.a)
  ; MIPS32:   G_BR %bb.11
  ; MIPS32: bb.10.b.PHI.2.1:
  ; MIPS32:   successors: %bb.11(0x80000000)
  ; MIPS32:   [[LOAD7:%[0-9]+]]:fprb(s64) = G_LOAD [[LOAD]](p0) :: (load (s64) from %ir.b)
  ; MIPS32: bb.11.b.PHI.2:
  ; MIPS32:   successors: %bb.13(0x40000000), %bb.12(0x40000000)
  ; MIPS32:   [[PHI1:%[0-9]+]]:fprb(s64) = G_PHI [[LOAD6]](s64), %bb.9, [[LOAD7]](s64), %bb.10
  ; MIPS32:   [[C5:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY9:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND5:%[0-9]+]]:gprb(s32) = G_AND [[COPY9]], [[C5]]
  ; MIPS32:   G_BRCOND [[AND5]](s32), %bb.13
  ; MIPS32: bb.12.b.PHI.2.end:
  ; MIPS32:   G_STORE [[PHI1]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   RetRA
  ; MIPS32: bb.13.b.PHI.3:
  ; MIPS32:   [[PHI2:%[0-9]+]]:fprb(s64) = G_PHI [[PHI1]](s64), %bb.11, [[PHI]](s64), %bb.6
  ; MIPS32:   [[PHI3:%[0-9]+]]:fprb(s64) = G_PHI [[PHI1]](s64), %bb.11, [[PHI]](s64), %bb.6
  ; MIPS32:   [[C6:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY10:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND6:%[0-9]+]]:gprb(s32) = G_AND [[COPY10]], [[C6]]
  ; MIPS32:   [[SELECT:%[0-9]+]]:fprb(s64) = G_SELECT [[AND6]](s32), [[PHI2]], [[PHI3]]
  ; MIPS32:   [[COPY11:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND7:%[0-9]+]]:gprb(s32) = G_AND [[COPY11]], [[C6]]
  ; MIPS32:   [[SELECT1:%[0-9]+]]:fprb(s64) = G_SELECT [[AND7]](s32), [[SELECT]], [[PHI2]]
  ; MIPS32:   G_STORE [[SELECT1]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   G_STORE [[PHI2]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   RetRA
  bb.1.entry:
    liveins: $a0, $a1, $a2, $a3

    %7:_(s32) = COPY $a0
    %8:_(s32) = COPY $a1
    %9:_(s32) = COPY $a2
    %3:_(p0) = COPY $a3
    %10:_(p0) = G_FRAME_INDEX %fixed-stack.2
    %4:_(p0) = G_LOAD %10(p0) :: (load (p0) from %fixed-stack.2, align 8)
    %11:_(p0) = G_FRAME_INDEX %fixed-stack.1
    %5:_(p0) = G_LOAD %11(p0) :: (load (p0) from %fixed-stack.1)
    %12:_(p0) = G_FRAME_INDEX %fixed-stack.0
    %6:_(p0) = G_LOAD %12(p0) :: (load (p0) from %fixed-stack.0, align 8)
    %32:_(s32) = G_CONSTANT i32 1
    %33:_(s32) = COPY %7(s32)
    %31:_(s32) = G_AND %33, %32
    G_BRCOND %31(s32), %bb.9

  bb.2.pre.PHI.1:
    %34:_(s32) = G_CONSTANT i32 1
    %35:_(s32) = COPY %8(s32)
    %30:_(s32) = G_AND %35, %34
    G_BRCOND %30(s32), %bb.5

  bb.3.pre.PHI.1.0:
    %36:_(s32) = G_CONSTANT i32 1
    %37:_(s32) = COPY %9(s32)
    %29:_(s32) = G_AND %37, %36
    G_BRCOND %29(s32), %bb.6

  bb.4.b.PHI.1.0:
    %13:_(s64) = G_LOAD %3(p0) :: (load (s64) from %ir.a)
    G_BR %bb.7

  bb.5.b.PHI.1.1:
    %15:_(s64) = G_LOAD %4(p0) :: (load (s64) from %ir.b)
    G_BR %bb.7

  bb.6.b.PHI.1.2:
    %14:_(s64) = G_LOAD %5(p0) :: (load (s64) from %ir.c)

  bb.7.b.PHI.1:
    %16:_(s64) = G_PHI %13(s64), %bb.4, %15(s64), %bb.5, %14(s64), %bb.6
    %38:_(s32) = G_CONSTANT i32 1
    %39:_(s32) = COPY %9(s32)
    %28:_(s32) = G_AND %39, %38
    G_BRCOND %28(s32), %bb.8
    G_BR %bb.14

  bb.8.b.PHI.1.end:
    G_STORE %16(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

  bb.9.pre.PHI.2:
    %40:_(s32) = G_CONSTANT i32 1
    %41:_(s32) = COPY %7(s32)
    %27:_(s32) = G_AND %41, %40
    G_BRCOND %27(s32), %bb.10
    G_BR %bb.11

  bb.10.b.PHI.2.0:
    %18:_(s64) = G_LOAD %3(p0) :: (load (s64) from %ir.a)
    G_BR %bb.12

  bb.11.b.PHI.2.1:
    %17:_(s64) = G_LOAD %4(p0) :: (load (s64) from %ir.b)

  bb.12.b.PHI.2:
    %19:_(s64) = G_PHI %18(s64), %bb.10, %17(s64), %bb.11
    %42:_(s32) = G_CONSTANT i32 1
    %43:_(s32) = COPY %8(s32)
    %26:_(s32) = G_AND %43, %42
    G_BRCOND %26(s32), %bb.14

  bb.13.b.PHI.2.end:
    G_STORE %19(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

  bb.14.b.PHI.3:
    %20:_(s64) = G_PHI %19(s64), %bb.12, %16(s64), %bb.7
    %21:_(s64) = G_PHI %19(s64), %bb.12, %16(s64), %bb.7
    %44:_(s32) = G_CONSTANT i32 1
    %45:_(s32) = COPY %9(s32)
    %25:_(s32) = G_AND %45, %44
    %22:_(s64) = G_SELECT %25(s32), %20, %21
    %46:_(s32) = COPY %8(s32)
    %24:_(s32) = G_AND %46, %44
    %23:_(s64) = G_SELECT %24(s32), %22, %20
    G_STORE %23(s64), %6(p0) :: (store (s64) into %ir.result)
    G_STORE %20(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

...
---
name:            long_chain_double_in_fpr
alignment:       4
legalized:       true
tracksRegLiveness: true
fixedStack:
  - { id: 0, offset: 24, size: 4, alignment: 8, isImmutable: true }
  - { id: 1, offset: 20, size: 4, alignment: 4, isImmutable: true }
  - { id: 2, offset: 16, size: 4, alignment: 8, isImmutable: true }
body:             |
  ; MIPS32-LABEL: name: long_chain_double_in_fpr
  ; MIPS32: bb.0.entry:
  ; MIPS32:   successors: %bb.8(0x40000000), %bb.1(0x40000000)
  ; MIPS32:   liveins: $a0, $a1, $a2, $a3
  ; MIPS32:   [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
  ; MIPS32:   [[COPY1:%[0-9]+]]:gprb(s32) = COPY $a1
  ; MIPS32:   [[COPY2:%[0-9]+]]:gprb(s32) = COPY $a2
  ; MIPS32:   [[COPY3:%[0-9]+]]:gprb(p0) = COPY $a3
  ; MIPS32:   [[FRAME_INDEX:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
  ; MIPS32:   [[LOAD:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (load (p0) from %fixed-stack.0, align 8)
  ; MIPS32:   [[FRAME_INDEX1:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.1
  ; MIPS32:   [[LOAD1:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX1]](p0) :: (load (p0) from %fixed-stack.1)
  ; MIPS32:   [[FRAME_INDEX2:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.2
  ; MIPS32:   [[LOAD2:%[0-9]+]]:gprb(p0) = G_LOAD [[FRAME_INDEX2]](p0) :: (load (p0) from %fixed-stack.2, align 8)
  ; MIPS32:   [[C:%[0-9]+]]:fprb(s64) = G_FCONSTANT double 0.000000e+00
  ; MIPS32:   [[C1:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY4:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
  ; MIPS32:   [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY4]], [[C1]]
  ; MIPS32:   G_BRCOND [[AND]](s32), %bb.8
  ; MIPS32: bb.1.pre.PHI.1:
  ; MIPS32:   successors: %bb.4(0x40000000), %bb.2(0x40000000)
  ; MIPS32:   [[C2:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY5:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND1:%[0-9]+]]:gprb(s32) = G_AND [[COPY5]], [[C2]]
  ; MIPS32:   G_BRCOND [[AND1]](s32), %bb.4
  ; MIPS32: bb.2.pre.PHI.1.0:
  ; MIPS32:   successors: %bb.5(0x40000000), %bb.3(0x40000000)
  ; MIPS32:   [[C3:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY6:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND2:%[0-9]+]]:gprb(s32) = G_AND [[COPY6]], [[C3]]
  ; MIPS32:   G_BRCOND [[AND2]](s32), %bb.5
  ; MIPS32: bb.3.b.PHI.1.0:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD3:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY3]](p0) :: (load (s64) from %ir.a)
  ; MIPS32:   G_BR %bb.6
  ; MIPS32: bb.4.b.PHI.1.1:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD4:%[0-9]+]]:fprb(s64) = G_LOAD [[LOAD]](p0) :: (load (s64) from %ir.b)
  ; MIPS32:   G_BR %bb.6
  ; MIPS32: bb.5.b.PHI.1.2:
  ; MIPS32:   successors: %bb.6(0x80000000)
  ; MIPS32:   [[LOAD5:%[0-9]+]]:fprb(s64) = G_LOAD [[LOAD1]](p0) :: (load (s64) from %ir.c)
  ; MIPS32: bb.6.b.PHI.1:
  ; MIPS32:   successors: %bb.7(0x40000000), %bb.13(0x40000000)
  ; MIPS32:   [[PHI:%[0-9]+]]:fprb(s64) = G_PHI [[LOAD3]](s64), %bb.3, [[LOAD4]](s64), %bb.4, [[LOAD5]](s64), %bb.5
  ; MIPS32:   [[C4:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY7:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND3:%[0-9]+]]:gprb(s32) = G_AND [[COPY7]], [[C4]]
  ; MIPS32:   G_BRCOND [[AND3]](s32), %bb.7
  ; MIPS32:   G_BR %bb.13
  ; MIPS32: bb.7.b.PHI.1.end:
  ; MIPS32:   G_STORE [[PHI]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   RetRA
  ; MIPS32: bb.8.pre.PHI.2:
  ; MIPS32:   successors: %bb.9(0x40000000), %bb.10(0x40000000)
  ; MIPS32:   [[C5:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY8:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
  ; MIPS32:   [[AND4:%[0-9]+]]:gprb(s32) = G_AND [[COPY8]], [[C5]]
  ; MIPS32:   G_BRCOND [[AND4]](s32), %bb.9
  ; MIPS32:   G_BR %bb.10
  ; MIPS32: bb.9.b.PHI.2.0:
  ; MIPS32:   successors: %bb.11(0x80000000)
  ; MIPS32:   [[LOAD6:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY3]](p0) :: (load (s64) from %ir.a)
  ; MIPS32:   G_BR %bb.11
  ; MIPS32: bb.10.b.PHI.2.1:
  ; MIPS32:   successors: %bb.11(0x80000000)
  ; MIPS32:   [[LOAD7:%[0-9]+]]:fprb(s64) = G_LOAD [[LOAD]](p0) :: (load (s64) from %ir.b)
  ; MIPS32: bb.11.b.PHI.2:
  ; MIPS32:   successors: %bb.13(0x40000000), %bb.12(0x40000000)
  ; MIPS32:   [[PHI1:%[0-9]+]]:fprb(s64) = G_PHI [[LOAD6]](s64), %bb.9, [[LOAD7]](s64), %bb.10
  ; MIPS32:   [[C6:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY9:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND5:%[0-9]+]]:gprb(s32) = G_AND [[COPY9]], [[C6]]
  ; MIPS32:   G_BRCOND [[AND5]](s32), %bb.13
  ; MIPS32: bb.12.b.PHI.2.end:
  ; MIPS32:   G_STORE [[PHI1]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   RetRA
  ; MIPS32: bb.13.b.PHI.3:
  ; MIPS32:   [[PHI2:%[0-9]+]]:fprb(s64) = G_PHI [[PHI1]](s64), %bb.11, [[PHI]](s64), %bb.6
  ; MIPS32:   [[PHI3:%[0-9]+]]:fprb(s64) = G_PHI [[PHI1]](s64), %bb.11, [[C]](s64), %bb.6
  ; MIPS32:   [[C7:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
  ; MIPS32:   [[COPY10:%[0-9]+]]:gprb(s32) = COPY [[COPY2]](s32)
  ; MIPS32:   [[AND6:%[0-9]+]]:gprb(s32) = G_AND [[COPY10]], [[C7]]
  ; MIPS32:   [[SELECT:%[0-9]+]]:fprb(s64) = G_SELECT [[AND6]](s32), [[PHI2]], [[PHI3]]
  ; MIPS32:   [[COPY11:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
  ; MIPS32:   [[AND7:%[0-9]+]]:gprb(s32) = G_AND [[COPY11]], [[C7]]
  ; MIPS32:   [[SELECT1:%[0-9]+]]:fprb(s64) = G_SELECT [[AND7]](s32), [[SELECT]], [[PHI2]]
  ; MIPS32:   G_STORE [[SELECT1]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   G_STORE [[PHI2]](s64), [[LOAD2]](p0) :: (store (s64) into %ir.result)
  ; MIPS32:   RetRA
  bb.1.entry:
    liveins: $a0, $a1, $a2, $a3

    %7:_(s32) = COPY $a0
    %8:_(s32) = COPY $a1
    %9:_(s32) = COPY $a2
    %3:_(p0) = COPY $a3
    %10:_(p0) = G_FRAME_INDEX %fixed-stack.2
    %4:_(p0) = G_LOAD %10(p0) :: (load (p0) from %fixed-stack.2, align 8)
    %11:_(p0) = G_FRAME_INDEX %fixed-stack.1
    %5:_(p0) = G_LOAD %11(p0) :: (load (p0) from %fixed-stack.1)
    %12:_(p0) = G_FRAME_INDEX %fixed-stack.0
    %6:_(p0) = G_LOAD %12(p0) :: (load (p0) from %fixed-stack.0, align 8)
    %24:_(s64) = G_FCONSTANT double 0.000000e+00
    %33:_(s32) = G_CONSTANT i32 1
    %34:_(s32) = COPY %7(s32)
    %32:_(s32) = G_AND %34, %33
    G_BRCOND %32(s32), %bb.9

  bb.2.pre.PHI.1:
    %35:_(s32) = G_CONSTANT i32 1
    %36:_(s32) = COPY %8(s32)
    %31:_(s32) = G_AND %36, %35
    G_BRCOND %31(s32), %bb.5

  bb.3.pre.PHI.1.0:
    %37:_(s32) = G_CONSTANT i32 1
    %38:_(s32) = COPY %9(s32)
    %30:_(s32) = G_AND %38, %37
    G_BRCOND %30(s32), %bb.6

  bb.4.b.PHI.1.0:
    %13:_(s64) = G_LOAD %3(p0) :: (load (s64) from %ir.a)
    G_BR %bb.7

  bb.5.b.PHI.1.1:
    %15:_(s64) = G_LOAD %4(p0) :: (load (s64) from %ir.b)
    G_BR %bb.7

  bb.6.b.PHI.1.2:
    %14:_(s64) = G_LOAD %5(p0) :: (load (s64) from %ir.c)

  bb.7.b.PHI.1:
    %16:_(s64) = G_PHI %13(s64), %bb.4, %15(s64), %bb.5, %14(s64), %bb.6
    %39:_(s32) = G_CONSTANT i32 1
    %40:_(s32) = COPY %9(s32)
    %29:_(s32) = G_AND %40, %39
    G_BRCOND %29(s32), %bb.8
    G_BR %bb.14

  bb.8.b.PHI.1.end:
    G_STORE %16(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

  bb.9.pre.PHI.2:
    %41:_(s32) = G_CONSTANT i32 1
    %42:_(s32) = COPY %7(s32)
    %28:_(s32) = G_AND %42, %41
    G_BRCOND %28(s32), %bb.10
    G_BR %bb.11

  bb.10.b.PHI.2.0:
    %18:_(s64) = G_LOAD %3(p0) :: (load (s64) from %ir.a)
    G_BR %bb.12

  bb.11.b.PHI.2.1:
    %17:_(s64) = G_LOAD %4(p0) :: (load (s64) from %ir.b)

  bb.12.b.PHI.2:
    %19:_(s64) = G_PHI %18(s64), %bb.10, %17(s64), %bb.11
    %43:_(s32) = G_CONSTANT i32 1
    %44:_(s32) = COPY %8(s32)
    %27:_(s32) = G_AND %44, %43
    G_BRCOND %27(s32), %bb.14

  bb.13.b.PHI.2.end:
    G_STORE %19(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

  bb.14.b.PHI.3:
    %20:_(s64) = G_PHI %19(s64), %bb.12, %16(s64), %bb.7
    %21:_(s64) = G_PHI %19(s64), %bb.12, %24(s64), %bb.7
    %45:_(s32) = G_CONSTANT i32 1
    %46:_(s32) = COPY %9(s32)
    %26:_(s32) = G_AND %46, %45
    %22:_(s64) = G_SELECT %26(s32), %20, %21
    %47:_(s32) = COPY %8(s32)
    %25:_(s32) = G_AND %47, %45
    %23:_(s64) = G_SELECT %25(s32), %22, %20
    G_STORE %23(s64), %6(p0) :: (store (s64) into %ir.result)
    G_STORE %20(s64), %6(p0) :: (store (s64) into %ir.result)
    RetRA

...
